<template>
  <div class="theme-container">
    <el-button type="primary" size="small" @click="drawer = !drawer">切换主题</el-button>
    <el-button type="primary">按钮</el-button>
    <theme-picker class="mg-l-10" style="height: 26px;margin: -3px 8px 0 0;" @change="themeChange" />
  </div>
</template>

<script>
import ThemePicker from '@/components/ThemePicker/index.vue'

export default {
  name: 'Theme',
  components: { ThemePicker },
  data() {
    return {
      drawer: false
    }
  },
  computed: {
    fixedHeader: {
      get() {
        return this.$store.state.settings.fixedHeader
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'fixedHeader',
          value: val
        })
      }
    },
    tagsView: {
      get() {
        return this.$store.state.settings.tagsView
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'tagsView',
          value: val
        })
      }
    },
    sidebarLogo: {
      get() {
        return this.$store.state.settings.sidebarLogo
      },
      set(val) {
        this.$store.dispatch('settings/changeSetting', {
          key: 'sidebarLogo',
          value: val
        })
      }
    }
  },
  methods: {
    themeChange(val) {
      this.$store.dispatch('settings/changeSetting', {
        key: 'theme',
        value: val
      })
    },
    handleClose() {
      this.drawer = false
    }
  }
}
</script>

<style lang="scss" scoped>
.theme-container{
  height: 100%;
  background-color: #fff;
  padding: 20px;
  display: flex;
  align-items: center;
  .drawer-container {
    float: right;
    width: 350px;
    padding: 24px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;

    .drawer-title {
      margin-bottom: 12px;
      color: rgba(0, 0, 0, .85);
      font-size: 14px;
      line-height: 22px;
    }

    .drawer-item {
      color: rgba(0, 0, 0, .65);
      font-size: 14px;
      padding: 12px 0;
    }

    .drawer-switch {
      float: right
    }
  }
}
</style>
